Implement "gravity" for RTL mode in a better way: Keep the distance from
authorMatthias Clasen <maclas@gmx.de>
Fri, 12 Dec 2003 23:40:58 +0000 (23:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 12 Dec 2003 23:40:58 +0000 (23:40 +0000)
Sat Dec 13 00:39:24 2003  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkviewport.c (viewport_set_hadjustment_values): Implement
"gravity" for RTL mode in a better way: Keep the distance from
the upper end of the page to the upper bound constant. This also
fixes problems with the initial position of the viewport in RTL
mode.  (#129063)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkviewport.c

index a33f30f417b68b7037f5e6197eb268462b222372..51942c8b333db0d0629aade2fa96cadc8d4e19f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sat Dec 13 00:39:24 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkviewport.c (viewport_set_hadjustment_values): Implement
+       "gravity" for RTL mode in a better way: Keep the distance from 
+       the upper end of the page to the upper bound constant. This also 
+       fixes problems with the initial position of the viewport in RTL 
+       mode.  (#129063)
+       
 Fri Dec 12 21:00:12 2003  Kristian Rietveld  <kris@gtk.org>
 
        Combo box flipping support.
index a33f30f417b68b7037f5e6197eb268462b222372..51942c8b333db0d0629aade2fa96cadc8d4e19f3 100644 (file)
@@ -1,3 +1,11 @@
+Sat Dec 13 00:39:24 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkviewport.c (viewport_set_hadjustment_values): Implement
+       "gravity" for RTL mode in a better way: Keep the distance from 
+       the upper end of the page to the upper bound constant. This also 
+       fixes problems with the initial position of the viewport in RTL 
+       mode.  (#129063)
+       
 Fri Dec 12 21:00:12 2003  Kristian Rietveld  <kris@gtk.org>
 
        Combo box flipping support.
index a33f30f417b68b7037f5e6197eb268462b222372..51942c8b333db0d0629aade2fa96cadc8d4e19f3 100644 (file)
@@ -1,3 +1,11 @@
+Sat Dec 13 00:39:24 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkviewport.c (viewport_set_hadjustment_values): Implement
+       "gravity" for RTL mode in a better way: Keep the distance from 
+       the upper end of the page to the upper bound constant. This also 
+       fixes problems with the initial position of the viewport in RTL 
+       mode.  (#129063)
+       
 Fri Dec 12 21:00:12 2003  Kristian Rietveld  <kris@gtk.org>
 
        Combo box flipping support.
index a33f30f417b68b7037f5e6197eb268462b222372..51942c8b333db0d0629aade2fa96cadc8d4e19f3 100644 (file)
@@ -1,3 +1,11 @@
+Sat Dec 13 00:39:24 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkviewport.c (viewport_set_hadjustment_values): Implement
+       "gravity" for RTL mode in a better way: Keep the distance from 
+       the upper end of the page to the upper bound constant. This also 
+       fixes problems with the initial position of the viewport in RTL 
+       mode.  (#129063)
+       
 Fri Dec 12 21:00:12 2003  Kristian Rietveld  <kris@gtk.org>
 
        Combo box flipping support.
index a33f30f417b68b7037f5e6197eb268462b222372..51942c8b333db0d0629aade2fa96cadc8d4e19f3 100644 (file)
@@ -1,3 +1,11 @@
+Sat Dec 13 00:39:24 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkviewport.c (viewport_set_hadjustment_values): Implement
+       "gravity" for RTL mode in a better way: Keep the distance from 
+       the upper end of the page to the upper bound constant. This also 
+       fixes problems with the initial position of the viewport in RTL 
+       mode.  (#129063)
+       
 Fri Dec 12 21:00:12 2003  Kristian Rietveld  <kris@gtk.org>
 
        Combo box flipping support.
index 4977865ff54c37309c801c233b643b52f241c305..084a7a00b54b2926e0d370ef73a551b4f333491b 100644 (file)
@@ -383,10 +383,14 @@ viewport_set_hadjustment_values (GtkViewport *viewport,
   GtkAllocation view_allocation;
   GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
   gdouble old_page_size;
+  gdouble old_upper;
+  gdouble old_value;
   
   viewport_get_view_allocation (viewport, &view_allocation);  
 
   old_page_size = hadjustment->page_size;
+  old_upper = hadjustment->upper;
+  old_value = hadjustment->value;
   hadjustment->page_size = view_allocation.width;
   hadjustment->step_increment = view_allocation.width * 0.1;
   hadjustment->page_increment = view_allocation.width * 0.9;
@@ -405,8 +409,8 @@ viewport_set_hadjustment_values (GtkViewport *viewport,
 
   if (gtk_widget_get_direction (GTK_WIDGET (viewport)) == GTK_TEXT_DIR_RTL) 
     {
-      gdouble old_value = hadjustment->value;
-      hadjustment->value = hadjustment->value + old_page_size - hadjustment->page_size;
+      gdouble dist = old_upper - (old_value + old_page_size);
+      hadjustment->value = hadjustment->upper - dist - hadjustment->page_size;
       viewport_reclamp_adjustment (hadjustment, value_changed);
       *value_changed = (old_value != hadjustment->value);
     }